#ifndef FRAMEWORK_H
#define FRAMEWORK_H

#include <QGLViewer/qglviewer.h>
#include <QMainWindow>
#include <QtGui>
#include <QObject>
#include "Render.h"
#include "Trajectory.h"
#include "Model.h"
#include "PhysicsWorld.h"
#include "Macro.h"

class FrameWork : public QWidget
{
	Q_OBJECT

public:
	FrameWork();

private slots:
	void openFile();
	void saveFile();
	void recordPath();
	void savePath();
	void loadPath();
	void pausePath();
	void resetAll();
	void resetData();
	void resetParam();
	void replay();
	void changeReplayIters(const QString & text);
	void changeValueMuSpinBox1(int val);
	void changeValueMuSpinBox2(int val);
	void changeValueMuSlider1(double val);
	void changeValueMuSlider2(double val);
	void changeValueMassSpinBox(double val);

private:
	void initData();
	void createMenus();
	void createParamGroup();
	void createNoiseGroup();
	void createGroupLayout();

	QMenu *fileMenu;
	QAction *openFileAct;
	QAction *saveFileAct;
	QAction *exitFileAct;

	QMenu *pathMenu;
	QAction *recordPathAct;
	QAction *savePathAct;
	QAction *loadPathAct;
	QAction *pausePathAct;

	QMenu *viewMenu;
	QAction *resetAllAct;
	QAction *resetDataAct;
	QAction *resetParamAct;
	QAction *replayAct;

	Render* rd;
	Trajectory* traj;
	PhysicsWorld* pw;
	Model* model;
	IKSolver* ccd;

	QHBoxLayout *mainLayout;
	QVBoxLayout *groupLayout;

	QMenuBar* mBar;
	QGroupBox* paramGroup;
	QGroupBox* noiseGroup;

	QLabel* replayIterLabel;
	QLineEdit* replayIterEditor;

	QLabel* muLabel1;
	QSlider* muSlider1;
	QDoubleSpinBox* muSpinBox1;

	QLabel* muLabel2;
	QSlider* muSlider2;
	QDoubleSpinBox* muSpinBox2;

	QLabel* massLabel;
	QDoubleSpinBox* massSpinBox;
};

#endif